package DataBaseManager;

import java.io.Serializable;

import DataType.MyDataType;
import DataType.MyDataType.MY_TYPE;

public class Field implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String name;
	private MyDataType.MY_TYPE type;
	private boolean unique;
	private boolean allowNull;
	
	Constraint[] constraints;
	public Field(String name,MyDataType.MY_TYPE type)
	{
		this.name = name;
		this.type = type;
		allowNull = true;
		unique = false;
	}
	public MyDataType.MY_TYPE getType() {
		return type;
	}
	public String getName()
	{
		return name.toLowerCase();
	}
	public void setName(String input){
		this.name = input;
	}
	public void setType(MY_TYPE input){
		this.type = input;
	}
	
	public boolean Unique()
	{
		return unique;
	}
	public boolean AllowNull()
	{
		return allowNull;
	}
	public void setUnique(boolean b)
	{
		unique = b;
		
	}
	public void setAllowNull(boolean b)
	{
		allowNull = b;
	}
	public void setPrivateKey(boolean b)
	{
		unique = b;
		allowNull = !b;
	}
	public boolean PrivateKey()
	{
		return unique && !allowNull ;
	}
}
